(add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))
(add-to-list 'auto-mode-alist '("SConstruct" . python-mode))
(add-to-list 'auto-mode-alist '("SConscript" . python-mode))
(add-to-list 'auto-mode-alist '("\\.h$" . c++-mode))
(add-to-list 'auto-mode-alist '("\\.inl$" . c++-mode))
;; (add-to-list 'auto-mode-alist '("\\.java$" . jde-mode))
;; (setq auto-mode-alist
;;       (append '(("\\.java$" . jde-mode)) auto-mode-alist))



;; jde-mode
;; (add-hook 'jde-mode-hook
;;           (lambda ()
;;             (setq c-basic-offset 4)))


;; c/c++-mode
(defun my-c-mode-common-hook ()
  ;(c-toggle-auto-state)
  (c-toggle-hungry-state)
  (c-subword-mode)
  (setq c-basic-offset 4)
  ;(define-key c-mode-base-map [(tab)] 'my-indent-or-complete)
  (define-key c-mode-base-map [(meta \\)] 'semantic-ia-complete-symbol-menu)
  ;(define-key c-mode-base-map "." 'semantic-complete-self-insert)
  (define-key c-mode-base-map [(return)] 'cc-return))
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
(add-hook 'c-mode-hook 
          (lambda ()
            (c-set-style "k&r")
            (c-set-offset 'substatement-open 0)))
(add-hook 'c++-mode-hook
          (lambda ()
            (c-set-style "stroustrup")
            (c-set-offset 'innamespace 0)
            (c-set-offset 'inline-open 0)
            (c-set-offset 'inline-close 0)
            (c-set-offset 'substatement-open 0)))


;; python-mode
(add-hook 'python-mode-hook 
          (lambda ()
            (setq python-check-command "pylint")
            (setq eldoc-mode t)
            (define-key python-mode-map [(f5)] 'python-send-buffer)
            (define-key python-mode-map "\C-c\C-c" 'comment-region)
            (define-key python-mode-map "\M-a" 'python-beginning-of-statement)
            (define-key python-mode-map "\M-e" 'python-end-of-statement)
            ;(define-key python-mode-map [(meta \\)] 'python-complete-symbol)
            (define-key python-mode-map [(meta \\)] 'rope-code-assist)
            (define-key python-mode-map "\C-cg" 'rope-goto-definition)
            (define-key python-mode-map "\C-cj" 'rope-jump-to-global)
            (define-key python-mode-map "\C-cd" 'rope-show-doc)
            (define-key python-mode-map [(meta \\)] 'rope-code-assist)            
            (define-key python-mode-map [(return)] 'newline-and-indent)))
;; (add-hook 'python-mode-hook
;;           (lambda ()
;;             (define-key python-mode-map "\"" 'electric-pair)
;;             (define-key python-mode-map "\'" 'electric-pair)
;;             (define-key python-mode-map "(" 'electric-pair)
;;             (define-key python-mode-map "[" 'electric-pair)
;;             (define-key python-mode-map "{" 'electric-pair)))



;; tex-mode
(add-hook 'tex-mode-hook
          (lambda ()))
;            (define-key tex-mode-map [(f7)] 'tex-compile)))
;            (define-key tex-mode-map [(control ?c control ?c)] 'comment-region)))
